﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Interactivity;
using Microsoft.Phone.Controls;

namespace Odyssey.Interactivity
{
    /// <summary>
    /// Makes the attached element switch to back to the previous page when clicked on.
    /// </summary>
    public class GoBackAction : TargetedTriggerAction<FrameworkElement>
    {

        protected override void Invoke(object parameter)
        {
            var rootFrame = Application.Current.RootVisual as PhoneApplicationFrame;
            if (rootFrame != null)
            {
                rootFrame.GoBack();
            }
        }
    }
}
